package encomendaFacil.dao;

public class Queries {

	private Queries() {}
	
	
	//User Queries
	public static final String USER_LOGIN = "SELECT * FROM users WHERE login = ? AND password = ?";
	public static final String 	USER_FIND_BY_ID = "SELECT * FROM users WHERE id = ?";
	
	public static final String USER_INSERT = "INSERT INTO users(name, login, password, phone) VALUES(?,?,?,?)"+
			" ON DUPLICATE KEY UPDATE login=VALUES(login), password=VALUES(password), name=VALUES(name), phone=VALUES(phone)";
	
	public static final String USER_REMOVE = "DELETE FROM users WHERE id = ?";
	public static final String USER_ALTER_PASSWORD = "UPDATE users SET password = ? where id = ?";
	
	//Package Queries
	public static final String FIND_PACKAGE = "SELECT * FROM packages";
	
	public static final String PACKAGE_INSERT = "INSERT INTO packages(tracking_code, name, begin_date, last_modification, status, is_delivered, owner_id) VALUES(?,?,now(),now(),?,?,?)"+
			" ON DUPLICATE KEY UPDATE tracking_code = VALUES(tracking_code), name=VALUES(name), last_modification=now(), status=VALUES(status), is_delivered=VALUES(is_delivered)";
	
	public static final String PACKAGE_REMOVE = "DELETE FROM packages WHERE id = ?";
	public static final String PACKAGE_UPDATE_STATUS = "UPDATE packages SET status=?, last_modification=now() WHERE id=?";
	public static final String PACKAGE_UPDATE_DELIVERED = "UPDATE packages SET status=?, is_delivered=?, last_modification=now() WHERE id=?";
}
